package wsc.mcis.androidDevelpment;

import java.util.ArrayList;

import android.app.Activity;
import android.app.LauncherActivity.ListItem;
import android.os.Bundle;
import android.app.ListActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.MotionEvent;
import android.view.View;
import android.view.View.OnTouchListener;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.ListView;
import android.widget.Toast;

public class RMBLActivity extends ListActivity {
  public void onCreate(Bundle icicle) {
    super.onCreate(icicle);
    ArrayList<RMBLListItem> values = new ArrayList<RMBLListItem>();
    values.add(new SheetListItem("Sheet1","flowers",0));
    values.add(new SheetListItem("Sheet2","flowers",1));
    
    View footer = getLayoutInflater().inflate(R.layout.list_view_footer, null);
    ListView listView = getListView();
    listView.addFooterView(footer);
    
    Button button =(Button)findViewById(R.id.button_new);
    button.setText(R.string.button_text_new_sheet);
    button.setOnTouchListener(new OnTouchListener(){
        @Override
        public boolean onTouch(View v, MotionEvent event) {

          Intent startMe;
          
          startMe = new Intent(RMBLActivity.this,NewSheetActivity.class);
          startActivity(startMe);
          return false;
        }
    });
    
    PerformanceArrayAdapter adapter = new PerformanceArrayAdapter(this, values);
    setListAdapter(adapter);
  }

  @Override
  protected void onListItemClick(ListView l, View v, int position, long id) {
    SheetListItem item = (SheetListItem) getListAdapter().getItem(position);
    Toast.makeText(this, item.sheetID + " selected", Toast.LENGTH_LONG).show();
   
    Intent startMe;
    
    startMe = new Intent(RMBLActivity.this,ResumeSheetActivity.class);
    startMe.putExtra("sheetID", item.sheetID);
    startActivity(startMe);
    
    
    
  }
}